package com.多态.基础;
class ComputerPart{
    void turnOn(){
        System.out.println("打开");
    }
    void turnOff(){
        System.out.println("关闭");
    }
}
class Screen extends ComputerPart{
    @Override
    void turnOn() {
        System.out.println("屏幕亮起，显示欢迎界面");
    }

    @Override
    void turnOff() {
        System.out.println("屏幕逐渐变暗，最终关闭");
    }
}
class Keyboard extends ComputerPart{
    @Override
    void turnOn() {
        System.out.println("键盘指示灯亮起，开始响应按键输入");
    }

    @Override
    void turnOff() {
        System.out.println("键盘指示灯熄灭，停止响应按键输入");
    }
}
public class 多态 {
    public static void fun1(ComputerPart computerPart){
        computerPart.turnOn();
        computerPart.turnOff();
    }
    public static void main(String[] args) {
        Screen screen = new Screen();
        Keyboard keyboard = new Keyboard();
        fun1(screen);
        fun1(keyboard);
    }
}
